
 function ChangeCate(){
	CateID=document.getElementById('txtcat').value;
	document.ViewAllFile.action="view_all_files.html?txtcat="+CateID+"";
	document.ViewAllFile.submit();		
 }
 function home(){
	 window.location = 'Login.html';
 }
 function ChangeCateSearch(){
	 CateID=document.getElementById('txtcat').value;
	 keyword=document.getElementById('txtkeyword').text;
	document.search_file.action="search_files.html?txtcat="+CateID+"&txtkeyword="+keyword+"";
	 document.search_file.submit();
 }
 //Registration Form
 function validateForm(){
	 var j=0;
	 var userid=document.forms["Registration"]["userid"].value;
	 var fullname=document.forms["Registration"]["fullname"].value;	
	 var password=document.forms["Registration"]["password"].value;
	 var conpassword=document.forms["Registration"]["conpassword"].value;
	 var mail=document.forms["Registration"]["mail"].value;
	 var dpt=document.getElementById('dpt').value;
	 if(fullname==""|fullname==null){
	 		alert("Full name cannot be empty!");
	 		return false;
	 	}
	 if(userid==""||userid==null){
	 	alert("User ID cannot be empty!");
	 	return false;
	 }
	 if(password==""||password==null){
	 	alert("Password cannot be empty!");
	 	return false;
	 }
	 if(conpassword==""||conpassword==null || conpassword!=password){
	 	alert("Confirm Password doesn't match!");
	 	return false;
	 }
	 if(mail==""||mail==null){
	 	alert("Email can't be empty!");
	 	return false;
	 }
	 	var at="@";
	 		var dot=".";
	 		var lat=mail.indexOf(at);
	 		var lstr=mail.length;	
	 	 if (mail.substring(lat+1,lstr)!="nbc.org.kh" || mail==""||mail==null){
	       alert("Sorry!!\nOnly NBC Email is Valide.\nIf you don't have OR forget your NBC's email or password, Please contact IT department for assistant.\n\n\Thanks!")
	 	return false;
	 }	 	 
	 if(dpt==0){
		 alert("Please select Department!");
	 		return false;
	 	}  
	 var user=document.forms["Registration"]["hide"].value;
	 var uid=new Array();
	 uid=user.split("|");
	 for(var i=0; i<uid.length;i++)
		 if(uid[i]==userid){
			alert("UserID is existed,\n please choose different ID and try again.");
			 return false;		
 	 }
	 alert("Successfully Registered!");
	 }